home *** CD-ROM | disk | FTP | other *** search
- @echo OFF
- REM ***********************************************************
- REM *** MouseWin.bat - Run windows if mouse key is pressed ***
- REM *** ver.1 else timeout and do not run windows. ***
- REM *** This will run some CEnvi code that ***
- REM *** will keep checking for the mouse ***
- REM *** being pressed and will exit with ***
- REM *** ERRORLEVEL 1 if the mouse was ***
- REM *** pressed, or ERRORLEVEL 0 if timeout. ***
- REM *** If ERRORLEVEL 1 run Windows. ***
- REM ***********************************************************
-
- CEnvi %0.bat
- GOTO CENVI_EXIT
-
- #define TIMEOUT 30 // how many seconds before timeout
-
- // Print instructions
- puts("Press mouse button to run Windows...");
-
- // Initialize the mouse
- reg.ax = 0;
- interrupt(0x33,reg);
-
- // until timeout, wait for mouse input
- StartTime = time();
- while ( difftime(time(),StartTime) < TIMEOUT ) {
- undefine(reg);
- reg.ax = 3;
- interrupt(0x33,reg);
- if ( reg.bx )
- exit(1);
- }
-
- // if made here then timeout
- exit(0);
-
- :CENVI_EXIT
-
- IF ERRORLEVEL 1 WIN